<template>
     <div>
        <h1>生命周期的演示</h1>
        <h2>{{count}}</h2>
     </div>
</template>

<script>
export default {
    data(){
        return{
            count:1
        }
    },
    beforeCreate(){
        console.log('1、beforeCreate');
    },
    created(){
        console.log('2、created');
    },
    beforeMount(){
        console.log('3、beforeMount');
    },
    mounted(){
        console.log('4、mounted');
        this.timer=setInterval(() => {
            this.count++
            console.log('****************count数据',this.count);
        }, 1000);
    },
    beforeUpdate(){
        console.log('5、beforeUpdate')
    },
    updated(){
        console.log('6、update');
    },
    beforeDestroy(){
        console.log('7、beforeDestroy');
         clearInterval(this.timer)
    },
    destroyed(){
        console.log('8、destroyed');
        // console.log('this',this);
       
    }
}
</script>

<style>

</style>